from threading import Timer


# 伤害值
class Damage:
    """伤害值"""

    def __init__(self, value):
        self.value = value


# 生命值
class Life:
    """生命值"""

    def __init__(self, value):
        self.value = value

    def __lt__(self, other):
        return self.value < other.value

    def __eq__(self, other):
        return self.value == other.value

    def __gt__(self, other):
        return self.value > other.value

    def __le__(self, other):
        if isinstance(other, int):
            return self.value <= other
        elif isinstance(other, Life):
            return self.value <= other.value

    def __ge__(self, other):
        return self.value >= other.value

    def __sub__(self, other):
        if isinstance(other, int):
            return Life(self.value - other)


# 速度值
class MSpeed:
    """速度"""

    def __init__(self, value: int):
        self.value = value

    def __add__(self, other):
        if isinstance(other, MSpeed):
            return MSpeed(self.value + other.value)
        if isinstance(other, int):
            return int(self.value + other)

    def __sub__(self, other):
        if isinstance(other, MSpeed):
            return MSpeed(self.value - other.value)
        if isinstance(other, int):
            return int(self.value - other)

    def __radd__(self, other):
        if isinstance(other, MSpeed):
            return MSpeed(self.value + other.value)
        if isinstance(other, int):
            return int(self.value + other)

    def __rsub__(self, other):
        if isinstance(other, MSpeed):
            return MSpeed(self.value - other.value)
        if isinstance(other, int):
            return int(self.value - other)

    def __neg__(self):
        """取负值"""
        return -self.value


class KSpeed:
    def __init__(self, value: int):
        self.value = value


# 阳光值类
class Sunshine:
    """阳光"""

    def __init__(self, value: int, interval: float = None):
        self.value = 0
        """阳光值"""
        if interval:
            Timer(interval=interval)
        """保存时间"""

    def __add__(self, value):
        if isinstance(value, Sunshine):
            self.value += value.value

    def __sub__(self, value):
        if isinstance(value, Sunshine):
            self.value -= value.value

    def close(self):
        """销毁阳光"""
